package com.fay.mymiaosha.response;

import lombok.Getter;
import lombok.Setter;

/**
 * @Title:
 * @Description:
 * @Author Fay Wang
 * @Date 2022/3/15 10:48
 * @Version 1.0
 */
@Setter
@Getter
public class CommonReturnType {
    // success or fail
    private String status;

    // success-> data, fail -> useful msg
    private Object data;

    // static method for building object, instead of constructor
    public static CommonReturnType create(Object res) {
        return CommonReturnType.create(res, "success");
    }

    public static CommonReturnType create(Object res, String status) {
        CommonReturnType response = new CommonReturnType();
        response.setStatus(status);
        response.setData(res);
        return response;
    }
}
